<%@page contentType="text/html;charset=UTF-8" isELIgnored="false" %>
<%@page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="sp" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>

<!DOCTYPE html>
<html>
	<head>
		<link rel="stylesheet" href="/app/widgets/reports/styles/main" type='text/css' />
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
		<script src="/static/scripts/jq-plugins/jquery.postmessage.js" type="text/javascript"></script>
		<script src="/static/scripts/jq-plugins/jquery.form.js" type="text/javascript"></script>
		<script src="/static/scripts/jq-plugins/jquery.textbox-hinter.min.js" type="text/javascript"></script>
		<script src="/static/scripts/hosted.js" type="text/javascript"></script>
		<script src="/app/widgets/reports/threadUpdate" type="text/javascript"></script>
	</head>
	<body>
		<div>
			<div id="voteChoices">
				<strong>Your vote for this report</strong><img id="loader" class="hidden" src="/static/images/ajax-loader.gif"><br/>
				<em>(<c:out value="${submission.report.threadID}" />)</em>
				
				<%-- Server-side information, translated to the client --%>
				<input type="hidden" id="hasVoted" value="${hasVoted}" />
				<input type="hidden" id="hintText" value="${hintText}" />
				
				<%-- Spring form begins here --%>
				<sp:form id="voteForm" commandName="submission" action="${submission.report.threadID}" method="post">
					<table id="violationChoices">
						<%-- This is a staging tr that gets deleted via JS --%>
						<tr id="checkboxStaging">
							<sp:checkboxes items="${violationList}" element="td" path="violations" />
						</tr>
						<tr>
							<td><a href="javascript:void(0);" id="openMoreOptions">More ...</a></td>
						</tr>
					</table>

					<div id="moreOptions">
						<div>Choose more violations:</div>
						<div class="panel">
							<button id="closeMoreOptions">OK</button>
						</div>
						<div id="optionList">
							<sp:checkboxes path="violations"  items="${moreViolations}" element="div" />
						</div>
					</div>
					
					<div id="actionChoices">
						<strong>Action</strong><br/>
						&nbsp;<sp:radiobuttons path="action" items="${actionList}" delimiter="&nbsp;" />
					</div>
					
					<div>
						<sp:input id="voteComment" path="comment" />
						<button id="post">Post Your Vote</button>
					</div>
				</sp:form>
			</div>
			
			<div id="voteCombinations">
				<c:forEach var="combo" items="${voteCombos}">
					<c:out value="${combo.key}" />: <c:out value="${combo.value}" /><br/>	
				</c:forEach>
			</div>
		</div>
	</body>
</html>